package com.tiantian.lianhui.boot.mq.rabbitmq.producer;

import com.tiantian.lianhui.boot.domain.dto.biz.ShortLinkStatsRecordDTO;
import lombok.RequiredArgsConstructor;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.stereotype.Component;

import static com.tiantian.lianhui.common.constant.RedisKeyConstant.SHORT_LINK_STATS_STREAM_TOPIC_KEY;

/**
 * @author tiantian
 */
@Component
@RequiredArgsConstructor
public class ShortLinkStatsSaveRabbitProducer {

    private final RabbitTemplate rabbitTemplate;

    public void send(ShortLinkStatsRecordDTO statsRecordDTO) {
        rabbitTemplate.convertAndSend(SHORT_LINK_STATS_STREAM_TOPIC_KEY, "", statsRecordDTO);
    }
}
